package com.zbkj.admin.controller.platform.v2;

import com.github.pagehelper.PageInfo;
import com.zbkj.dal.base.page.CommonPage;
import com.zbkj.dal.base.result.CommonResult;
import com.zbkj.dal.pojo.request.PageParamRequest;
import com.zbkj.dal.pojo.request.ShareQueryRequest;
import com.zbkj.dal.pojo.request.order.platform.PlatformShareOrderQueryRequest;
import com.zbkj.dal.pojo.response.ba.ShareDetailResponse;
import com.zbkj.dal.pojo.response.ba.ShareResponse;
import com.zbkj.dal.pojo.response.order.platform.PlatformShareOrderResponse;
import com.zbkj.service.service.order.platform.AdminPlatformShareOrderV2Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author wangzhengyan
 * @date 2024/4/12 9:12 PM
 */
@RestController
@Api(tags = "平台管理-供享订单")
@RequestMapping("/api/admin/platform/v2/order/share")
public class PlatformShareOrderV2Controller {

    @Resource
    private AdminPlatformShareOrderV2Service adminPlatformShareOrderV2Service;

    @ApiOperation(value = "分页获取共享信息")
    @RequestMapping(value = "/pageShares", method = RequestMethod.POST)
    public CommonResult<CommonPage<PlatformShareOrderResponse>> querySharesPaged(@RequestBody PlatformShareOrderQueryRequest shareQueryRequest, PageParamRequest pageParamRequest) {
        PageInfo<PlatformShareOrderResponse> sharePageInfo = adminPlatformShareOrderV2Service.querySharesPaged(shareQueryRequest, pageParamRequest);
        return CommonResult.success(CommonPage.restPage(sharePageInfo));
    }

    @ApiOperation(value = "奢品共享信息详情")
    @RequestMapping(value = "/detail/{orderNo}", method = RequestMethod.GET)
    public CommonResult<ShareDetailResponse> detail(@PathVariable("orderNo") String orderNo) {
        return CommonResult.success(adminPlatformShareOrderV2Service.detail(orderNo));
    }
}
